package com.itheima.xml.jsoup;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

import java.io.File;
import java.io.IOException;

public class JsoupDemo4 {
    public static void main(String[] args) throws IOException {
        String path = JsoupDemo4.class.getClassLoader().getResource("com//itheima//xml//jsoup//student.xml").getPath();
        Document document = Jsoup.parse(new File(path), "utf-8");
        /*Elements elements = document.getElementsByTag("name");
        System.out.println(elements.size());*/
        Element element_student = document.getElementsByTag("student").get(0);
        Elements ele_name = element_student.getElementsByTag("name");
        System.out.println(ele_name.text());
        String number = element_student.attr("number");
        System.out.println(number);
    }
}